<template>
  <el-dialog
    title="题目审核"
    :visible="check"
    @close="$emit('delCheck')"
    width="25%">
    <div style="margin: 15px 0 20px">
      <el-radio v-model="chkState" :label="1">通过</el-radio>
      <el-radio v-model="chkState" :label="2">拒绝</el-radio>
    </div>
    <el-input
      type="textarea"
      :rows="3"
      placeholder="请输入审核意见"
      v-model="chkRemarks">
    </el-input>
    <span slot="footer" class="dialog-footer">
      <el-button @click="$emit('delCheck')">取 消</el-button>
      <el-button type="primary" @click="onCheck">确 定</el-button>
    </span>
</el-dialog>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions'
import { Message } from 'element-ui'
export default {
  data () {
    return {
      chkState: 1,
      chkRemarks: ''
    }
  },
  model: {
    prop: 'check'
  },
  props: {
    check: {
      type: Boolean,
      required: true
    },

    id: {
      type: Number,
      required: true
    }
  },
  methods: {
    async onCheck () {
      await choiceCheck({
        id: this.id,
        chkState: this.chkState,
        chkRemarks: this.chkRemarks
      })
      Message({
        type: 'success',
        message: '审核成功'
      })
      this.$emit('checkSuccess')
    }
  }
}
</script>

<style scoped lang='less'></style>
